/*
 * @Author: 张小平
 * @Date:   2025-05-01
 * @Email:  qqshuqian@163.com
 * @Copyright © 2024 aseyun. All rights reserved.
 */
import request from '@/framework-core/axios';
import website from '@/framework-core/config/website';



export function loadSession() {
  return request({
    url: website.baseUrl+'/api/gtp/chatSession/list',
    method: 'post'
  })
}

export function addSession(title,modelId,sid) {
  return request({
    url: website.baseUrl+'/api/gtp/chatSession/save',
    method: 'post',
    data: {"title":title,"modelId":modelId,"sid":sid}
  })
}

export function removeSession(sid) {
  return request({
    url: website.baseUrl+'/api/gtp/chatSession/delete',
    method: 'post',
    data: {"sid":sid}
  })
}


export function loadConversation(sid) {
  return request({
    url: website.baseUrl+'/api/gtp/conversation/list',
    method: 'post',
    data: {"sid":sid}
  })
}

export function removeConversation(sid) {
  return request({
    url: website.baseUrl+'/api/gtp/conversation/delete',
    method: 'post',
    data: {"sid":sid}
  })
}

export function loadKnowledge() {
  return request({
    url: website.baseUrl+'/api/gtp/knowledge/detail',
    method: 'post'
  })
}

export function listKnowledge() {
  return request({
    url: website.baseUrl+'/api/gtp/knowledge/list',
    method: 'post'
  })
}

export function saveKnowledge(kid,knowledgeName) {
  let formData = new FormData();
  let url = '';
  if (kid){
    formData.append("kid",kid);
    url = '/knowledge/upload';
  }else {
    formData.append("kname",knowledgeName);
    url = '/knowledge/save';
  }
  return request({
    url: website.baseUrl+'/api/gtp/conversation/list',
    method: 'post'
  })
}

export function sendContent(data) {
  return request({
    url: website.baseUrl+'/api/gtp/sse/chat',
    method: 'post',
    data:data
  })

}
